package com.ideasmaker.service.user.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import com.ideasmaker.bean.User;
import com.ideasmaker.dao.user.IUserDao;
import com.ideasmaker.service.user.IUserService;
/**
 * 
 * @author arlord
 *
 */
@Component
public class UserServiceImpl implements IUserService {
	
	private Logger logger = Logger.getLogger(UserServiceImpl.class);
	
	private IUserDao  userDao;

	public IUserDao getUserDao() {
		return userDao;
	}

	@Resource
	public void setUserDao(IUserDao userDao) {
		this.userDao = userDao;
	}

	public void saveUser(User user) throws Exception {
		// TODO Auto-generated method stub
		logger.info("=============== user service  saveUser start=================");
		
		userDao.saveUser(user);
		
		logger.info("=============== user service  saveUser end =================");
	}

	public void deleteUser(User user) throws Exception {
		// TODO Auto-generated method stub
		logger.info("=============== user service  deleteUser start ================");

		userDao.deleteUser(user);
		
		logger.info("============== user service deleteUser end ==============");
	}

	public void updateUser(User user) throws Exception {
		// TODO Auto-generated method stub
		logger.info("=============== user service  updateUser start=================");
		userDao.updateUser(user);
		logger.info("============== user service updateUser end ==============");
	}

	public User queryUserById(User user) throws Exception {
		// TODO Auto-generated method stub
		logger.info("=============== user service  queryUserById start ================");
		User u = userDao.queryUserById(user);
		logger.info("============== user service queryUserById end ==============");
		return u;
	}

	public List<User> queryUserByFilter(UserQueryParam user) throws Exception {
		// TODO Auto-generated method stub
		logger.info("=============== user service  queryUserByFilter start===============");
		List<User> userList = userDao.queryUserByFilter(user);
		logger.info("============== user service queryUserByFilter end ==============");
		return userList;
	}

	public boolean findUserByName(User user) throws Exception {
		// TODO Auto-generated method stub
		
		logger.info("=============== user service  findUserByName ===============");
		return userDao.queryUserByName(user);
	}

}
